case GDK_FRAME_CLOCK_PHASE_LAYOUT:
if (priv->freeze_count == 0)
{
+ int iter;
#ifdef G_ENABLE_DEBUG
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
{
#endif /* G_ENABLE_DEBUG */
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
- if (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT)
+ /* We loop in the layout phase, because we don't want to progress
+ * into the paint phase with invalid size allocations. This may
+ * happen in some situation like races between user window
+ * resizes and natural size changes.
+ */
+ iter = 0;
+ while ((priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT) &&
+ priv->freeze_count == 0 && iter++ < 4)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
g_signal_emit_by_name (G_OBJECT (clock), "layout");
}
+ if (iter == 5)
+ g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
}
case GDK_FRAME_CLOCK_PHASE_PAINT:
if (priv->freeze_count == 0)